<?php
class Visita extends Doctrine_Record {
    public function setTableDefinition() {
        $this->setTableName('visita');
        $this->hasColumn('id', 'integer', 20, array('primary' => true, 'unsigned'=>true, 'autoincrement'=>true));
        $this->hasColumn('fecha', 'datetime');
        $this->hasColumn('id_publicacion', 'integer', 5, array('unsigned'=>true));
        $this->hasColumn('id_categoria', 'integer', 3, array('unsigned'=>true));
        $this->hasColumn('id_tag', 'integer', 3, array('unsigned'=>true));
    }
    
    public function setUp(){
        $this->hasOne('Publicacion as publicacion',array(
            'local'=>'id_publicacion',
            'foreign'=>'id'
        ));
        $this->hasOne('Categoria as categoria',array(
            'local'=>'id_categoria',
            'foreign'=>'id'
        ));
        $this->hasOne('Tag as tag',array(
            'local'=>'id_tag',
            'foreign'=>'id'
        ));
    }
}
?>